{include file="public/header" /}
{load href="__PLUGINS__bootstrap/bootstrap-table.min.css"}
{load href="__PLUGINS__bootstrap/bootstrap-table.min.js"}
<style>
    #des, #des input {
        width: 40px;
        text-align: center;
    }

    #id {
        width: 78px;
    }

    .bs-checkbox {
        width: 36px;
        height: 40px
    }

    .fixed-table-toolbar .columns, .fixed-table-toolbar .search {
        margin-left: 0px;
        margin-top: 0px
    }

    #title span {
        float: right;
    }

    .asdlkjasd {
        background: #1ab394;
        color: #fff
    }

    .leixing {
        color:#40BCF7;
        cursor:pointer;
    }

    .del {
        color:red !important;
    }
</style>
<body class="gray-bg">
<div class="wrapper wrapper-content {:config('adminClass.main')}">
    <div class="ibox float-e-margins">
        {include file="public/tophead"}
        {include file="public/top" /}
        <div class="ibox-content">
            {include file="public/topsection"}
            <div class="row row-lg">
                <div class="col-sm-12">
                    <div class="fixed-table-toolbar">
                        <a class="btn btn-default btn-outline {present name='channel_sex'}{eq name='channel_sex' value='0'}asdlkjasd{/eq}{/present}" href="{:url('gift',['channel_sex'=>0])}">通用</a>
                        <a class="btn btn-default btn-outline {present name='channel_sex'}{eq name='channel_sex' value='2'}asdlkjasd{/eq}{/present}" href="{:url('gift',['channel_sex'=>2])}">男</a>
                        <a class="btn btn-default btn-outline {present name='channel_sex'}{eq name='channel_sex' value='1'}asdlkjasd{/eq}{/present}" href="{:url('gift',['channel_sex'=>1])}">女</a>
                    </div>
                    <div class="fixed-table-toolbar" style="display:inline-block; margin-right:100px">
                        <a class="btn btn-default btn-outline {present name='types'}{else /}asdlkjasd{/present}"
                           href="{:url('gift')}{present name='channel_sex'}/channel_sex/{$channel_sex}{/present}">所&nbsp;&nbsp;有</a>
                        <a class="btn btn-default btn-outline {eq name='types' value='0'}asdlkjasd{/eq}"
                           href="{:url('gift',['types'=>0])}{present name='channel_sex'}/channel_sex/{$channel_sex}{/present}">搭&nbsp;&nbsp;讪</a>
                        <a class="btn btn-default btn-outline {eq name='types' value='1'}asdlkjasd{/eq}"
                           href="{:url('gift',['types'=>1])}{present name='channel_sex'}/channel_sex/{$channel_sex}{/present}">普&nbsp;&nbsp;通</a>
                        <a class="btn btn-default btn-outline {eq name='types' value='2'}asdlkjasd{/eq}"
                           href="{:url('gift',['types'=>2])}{present name='channel_sex'}/channel_sex/{$channel_sex}{/present}">贵&nbsp;&nbsp;族</a>
                    </div>
                    <div class="fixed-table-toolbar">
                        <form method="get" action="" style="display: flex;">
                            <div class="pull-left search" style="display: flex;">
                                <div class="columns columns-right btn-group pull-left">
                                    <select class="form-control" name="type">
                                        <option value="name" {php}if(input('?param.type')){if(input('param.type')=='name'){echo "selected";}}{/php}>名称</option>
                                    </select>
                                </div>

                                <div class="pull-right search">
                                    <input class="form-control input-outline" type="text"
                                        {php}
                                            if(input('?param.name')){
                                                if(input('param.name')){
                                                    echo "value='".input('name')."'";
                                                }
                                            }
                                        {/php}
                                    name="name" placeholder="搜索">
                                </div>

                                <div class="pull-right search">
                                    <button style="border-radius:0px; border:1px solid #e5e6e7; border-left:0px" class="btn btn-default btn-outline" type="submit">搜索</button>
                                </div>

                                {php}
                                if(input('?param.name')){
                                {/php}
                                <div class="pull-right search">
                                    <a class="btn btn-w-m btn-link" href="{:url('gift')}">返回列表</a>
                                </div>
                                {php}
                                }
                                {/php}
                            </div>
                        </form>
                    </div>
                    <div class="example">
                        <form class="form-horizontal" method="post">
                            <table data-toggle="table">
                                <thead>
                                <tr>
                                    <th data-align="center">ID</th>
                                    <th data-align="center">类型</th>
                                    <th data-align="center">预览</th>
                                    <th data-align="center">图片</th>
                                    <th data-align="center">名称</th>
                                    <th data-align="center">价格</th>
                                    <th data-align="center">管理</th>
                                </tr>
                                </thead>
                                <tbody id="form">
                                {volist name="data" id="v"}
                                <tr id="id{$v.id}" class="class">
                                    <td>{$v.id}</td>
                                    <td>
                                        {switch name="v.types"}
                                            {case value="0"}<a class="leixing" href="{:url('gift', ['types' => 0])}">搭讪</a>{/case}
                                            {case value="1"}<a class="leixing" href="{:url('gift', ['types' => 1])}">普通</a>{/case}
                                            {case value="2"}<a class="leixing" href="{:url('gift', ['types' => 2])}">VIP</a>{/case}
                                        {/switch}
                                    </td>
                                  <td>
										{php}
										$previewUrl = strpos($v['preview'], 'http') === false ? '__ROOT__' . $v['preview'] : $v['preview'];
										$escapedPreviewUrl = htmlspecialchars($previewUrl, ENT_QUOTES, 'UTF-8');
										{/php}
										{if condition="$escapedPreviewUrl"}
										<a href="{$escapedPreviewUrl}" title="{$v.name}" target="_blank" onclick="lookBigImg('{$escapedPreviewUrl}')">
											<img style="width:40px;height:40px;" src="{$escapedPreviewUrl}"/>
										</a>
										{/if}
										
                                    </td>
                                    <td>
										{php}
										$coverUrl = strpos($v['cover'], 'http') === false ? '__ROOT__' . $v['cover'] : $v['cover'];
										$escapedcoverUrl = htmlspecialchars($coverUrl, ENT_QUOTES, 'UTF-8');
										{/php}
										{if condition="$escapedcoverUrl"}
										<a href="{$escapedcoverUrl}" title="{$v.name}" target="_blank" onclick="lookBigImg('{$escapedcoverUrl}')">
											<img style="width:40px;height:40px;" src="{$escapedcoverUrl}"/>
										</a>
										{/if}
                                    </td>
                                    <td>{$v.name}</td>
                                    <td>{$v.price}</td>
                                    <td>
                                        <div class="btn-group">
                                            <div data-toggle="dropdown" class="btn btn-primary btn-xs dropdown-toggle">
                                                操作 <span class="caret"></span>
                                            </div>
                                            <ul class="dropdown-menu">
                                                <li><a onClick="add('{:url('addGift',['id'=>$v['id'],'url'=>-1])}')">修改</a></li>
                                                <li class="divider"></li>
                                                <li><a class="del" onClick="del({$v.id})">删除</a></li>
                                            </ul>
                                        </div>
                                    </td>
                                </tr>
                                {/volist}
                                </tbody>
                            </table>
                        </form>
                    </div>
                </div>
            </div>
            <hr>
            <div class="row row-lg">
                <div class="col-sm-12 pages">{$page}</div>
            </div>
        </div>
    </div>
</div>

{include file="public/footer" /}

<script type="text/javascript">

    function del(id){
        swal_del(id,"{:url('delGift')}")
    }

</script>
